
package com.fire.eyes.service.impl;

import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.baomidou.mybatisplus.mapper.Wrapper;
import com.baomidou.mybatisplus.plugins.pagination.Pagination;
import com.fire.eyes.dao.FireProprietorMapper;
import com.fire.eyes.model.FireProprietorModel;
import com.fire.eyes.service.IFireProprietorService;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.service.impl.ServiceImpl;
import com.baomidou.mybatisplus.plugins.Page;

import java.util.List;
import java.util.Map;

/**
 * 业主单位Service
 *
 * @author Matthew
 * @Date 2019-01-17 20:48
 */
@Service
public class FireProprietorServiceImpl extends ServiceImpl<FireProprietorMapper, FireProprietorModel> implements IFireProprietorService{

    private static final Logger LOGGER = LoggerFactory.getLogger(FireProprietorServiceImpl.class);

    @Autowired
    private FireProprietorMapper fireProprietorMapper;

    @Override
    public FireProprietorModel selectOne(FireProprietorModel entity){
        return fireProprietorMapper.selectOne(entity);
    }

    @Override
    public List<FireProprietorModel>selectList(FireProprietorModel model){
        return fireProprietorMapper.selectListByModel(model);
    }

    @Override
    public Page<FireProprietorModel> selectPage(int currentPage, int pageSize, Wrapper<FireProprietorModel> wrapper){
        return selectPage(new Page<FireProprietorModel>(currentPage,pageSize), wrapper);
    }

    @Override
    public Page<Map<String, Object>> selectMapsPage(int currentPage, int pageSize, Wrapper<FireProprietorModel> wrapper){
        return selectMapsPage(new Page<FireProprietorModel>(currentPage,pageSize), wrapper);
    }

    @Override
    public Map<String, Object> queryProprietor(String proprietor){
        return fireProprietorMapper.queryProprietor(proprietor);
    }

    /**
     * 我管理的业主单位（分页）
     * @param page
     * @param supervisorId
     * @return
     */
    @Override
    public Page<Map<String,Object>> queryMyProprietorsList(Page<Map<String,Object>> page, String supervisorId){
        return page.setRecords(fireProprietorMapper.queryMyProprietorsList(page, supervisorId));
    }

}
